package com.yunsoft.controller;

import java.util.HashMap;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yunsoft.service.StudentService;



@Controller
public class HelloController extends BasicController{
	@Autowired
	StudentService studentService;
	@RequestMapping(value="/hell",method=RequestMethod.GET)
	@ResponseBody
	public HashMap<String, Object> hello(
			@RequestParam(value = "username", required = true) String username,
			@RequestParam(value = "age", required = true) int age
			){
		System.out.println("进方法"+"username:"+username);
		
		HashMap<String, Object> result = new HashMap<String, Object>();
		studentService.create(username, age, 1992, 1);
		
		return returnSuccessData("成功",result);
	}
	

	@RequestMapping(value="/hello1",method=RequestMethod.GET)
	public String he(ModelMap map,@RequestParam(value = "comment", required = false) String comment){
		System.out.println("进方法"+"comment:"+comment);
		map.addAttribute("message", "hello world");
		return "hello";
	}
}
